﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;

namespace UtilZ.Dotnet.WindowsDesktopEx.WPF
{
    /// <summary>
    /// 表示可用于显示或编辑带水印的非格式化文本的控件。
    /// </summary>
    [ContentProperty("Text")]
    [Localizability(LocalizationCategory.Text)]
    public class WaterMarkTextBox : TextBox
    {
        /// <summary>
        /// 水印依赖属性
        /// </summary>
        public static readonly DependencyProperty WaterMarkProperty =
            DependencyProperty.Register(nameof(WaterMark), typeof(string), typeof(WaterMarkTextBox),
                new FrameworkPropertyMetadata(null, new PropertyChangedCallback(PropertyChanged)));

        private static void PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = d as WaterMarkTextBox;
            if (e.Property == WaterMarkProperty)
            {

            }
        }

        /// <summary>
        /// 获取或设置水印
        /// </summary>
        public string WaterMark
        {
            get
            {
                return (string)this.GetValue(WaterMarkProperty);
            }
            set
            {
                this.SetValue(WaterMarkProperty, value);
            }
        }


        /// <summary>
        /// 构造函数初始化
        /// </summary>
        public WaterMarkTextBox()
            : base()
        {

        }
    }
}
